import time
from selenium import webdriver
import pytest
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

@pytest.fixture(scope='function',name='driver')



def setup_teardown():
    driver = webdriver.Chrome()
    driver.get("http://jxc.b2zg.cn/#/login")
    driver.implicitly_wait(15)
    driver.maximize_window()
    # 点击体验一下
    WebDriverWait(driver, 10, 0.5).until(EC.presence_of_element_located((By.XPATH, "//*[text()='体验一下']"))).click()
    # 点击库存
    WebDriverWait(driver, 10, 0.5).until(EC.presence_of_element_located((By.XPATH, "//*[text()='库存']"))).click()
    # 点击盘点
    time.sleep(2)
    WebDriverWait(driver, 10, 0.5).until(EC.presence_of_all_elements_located((By.CLASS_NAME, "text")))[0].click()

    yield driver

    driver.quit()